#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# http://www.lmaye.com/

import json
import urllib.parse
from pip._vendor import requests

url = "http://www.lmaye.com/m/user/account/loadAccount.json";
params = urllib.parse.urlencode({"userId": "Y00000001"});

request = requests.get(url, params);
print("status_code:", request.status_code);
print("headers:", request.headers);
print("text:", request.text);
print("------------------------------------------");

loginUrl = "http://www.lmaye.com/m/user/login.json";
loginParams = json.dumps({"phoneNumber": "15072330003", "password": "admin"});
headers = {"Content-Type": "application/json;charset=UTF-8"};

loginRequest = requests.post(loginUrl, loginParams, headers=headers);
print("status_code:", loginRequest.status_code);
print("headers:", loginRequest.headers);
print("text:", loginRequest.text);
jn = loginRequest.json();
print(jn is not None)
print("json:", jn["code"]);
